package com.example.wangmj.watermark;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import com.example.wangmj.watermark.Photo.CameraConfig;

public class FirstpageAvtivity extends AppCompatActivity implements View.OnClickListener {

    /**
     * take photo
     */
    private Button mBtnTakephoto;
    private ImageView mIvPic;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }

    private void initView() {
        mBtnTakephoto = (Button) findViewById(R.id.btn_takephoto);
        mBtnTakephoto.setOnClickListener(this);
        mIvPic = (ImageView) findViewById(R.id.iv_pic);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {

            case R.id.btn_takephoto:

                Intent intent = new Intent(FirstpageAvtivity.this, PhotoActivity.class);
                intent.putExtra(CameraConfig.RATIO_WIDTH, 855);
                intent.putExtra(CameraConfig.RATIO_HEIGHT, 541);
                intent.putExtra(CameraConfig.PERCENT_WIDTH, 0.8f);
                intent.putExtra(CameraConfig.MASK_COLOR, 0x2f000000);
                intent.putExtra(CameraConfig.RECT_CORNER_COLOR, 0xff00ff00);
                intent.putExtra(CameraConfig.TEXT_COLOR, 0xffffffff);
                intent.putExtra(CameraConfig.HINT_TEXT, "请将方框对准证件拍照");
                intent.putExtra(CameraConfig.IMAGE_PATH, Environment.getExternalStorageDirectory().getAbsolutePath()+"/CameraCardCrop/"+System.currentTimeMillis()+".jpg");
                startActivity(intent);
                break;
                default:
                break;
        }
    }
}
